home *** CD-ROM | disk | FTP | other *** search
/ Almathera Ten Pack 3: CDPD 3 / Almathera Ten on Ten - Disc 3: CDPD3.iso / fish / 726-750 / 741 / rkrm_lib1 / rkrm_lib1.lha / ASL / fontreq.c < prev   
C/C++ Source or Header  |  1992-09-03  |  4KB  |  116 lines

  1. ;/* fontreq.c - Execute me to compile me with Lattice 5.10
  2. LC -b1 -cfistq -v -y -j73 fontreq.c
  3. Blink FROM LIB:c.o,fontreq.o TO fontreq LIBRARY LIB:LC.lib,LIB:Amiga.lib
  4. quit
  5. */
  6.  
  7. /*
  8. Copyright (c) 1992 Commodore-Amiga, Inc.
  9.  
  10. This example is provided in electronic form by Commodore-Amiga, Inc. for
  11. use with the "Amiga ROM Kernel Reference Manual: Libraries", 3rd Edition,
  12. published by Addison-Wesley (ISBN 0-201-56774-1).
  13.  
  14. The "Amiga ROM Kernel Reference Manual: Libraries" contains additional
  15. information on the correct usage of the techniques and operating system
  16. functions presented in these examples.  The source and executable code
  17. of these examples may only be distributed in free electronic form, via
  18. bulletin board or as part of a fully non-commercial and freely
  19. redistributable diskette.  Both the source and executable code (including
  20. comments) must be included, without modification, in any copy.  This
  21. example may not be published in printed form or distributed with any
  22. commercial product.  However, the programming techniques and support
  23. routines set forth in these examples may be used in the development
  24. of original executable software products for Commodore Amiga computers.
  25.  
  26. All other rights reserved.
  27.  
  28. This example is provided "as-is" and is subject to change; no
  29. warranties are made.  All use is at your own risk. No liability or
  30. responsibility is assumed.
  31. */
  32.  
  33. #include <exec/types.h>
  34. #include <libraries/asl.h>
  35.  
  36. #include <clib/asl_protos.h>
  37. #include <clib/exec_protos.h>
  38.  
  39. #include <stdio.h>
  40.  
  41. #ifdef LATTICE
  42. int CXBRK(void)     { return(0); }  /* Disable Lattice CTRL/C handling */
  43. void chkabort(void) { return; }     /* really */
  44. #endif
  45.  
  46. UBYTE *vers = "$VER: fontreq 37.0";
  47.  
  48. struct Library *AslBase = NULL;
  49.  
  50. /* Our replacement strings for the "mode" cycle gadget.  The
  51. ** first string is the cycle gadget's label.  The other strings
  52. ** are the actual strings that will appear on the cycle gadget.
  53. */
  54. UBYTE *modelist[] =
  55. {
  56.     "RKM Modes",
  57.     "Mode 0",
  58.     "Mode 1",
  59.     "Mode 2",
  60.     "Mode 3",
  61.     "Mode 4",
  62.     NULL
  63. };
  64.  
  65.  
  66. void main(int argc, char **argv)
  67. {
  68.     struct FontRequester *fr;
  69.  
  70.     if (AslBase = OpenLibrary("asl.library", 37L))
  71.     {
  72.         if (fr = (struct FontRequester *)
  73.             AllocAslRequestTags(ASL_FontRequest,
  74.                 /* tell the requester to use my custom mode names */
  75.                 ASL_ModeList, modelist,
  76.  
  77.                 /* Supply initial values for requester */
  78.                 ASL_FontName, (ULONG)"topaz.font",
  79.                 ASL_FontHeight, 11L,
  80.                 ASL_FontStyles, FSF_BOLD | FSF_ITALIC,
  81.                 ASL_FrontPen,  0x00L,
  82.                 ASL_BackPen,   0x01L,
  83.  
  84.                 /* Only display font sizes between 8 and 14, inclusive. */
  85.                 ASL_MinHeight, 8L,
  86.                 ASL_MaxHeight, 14L,
  87.  
  88.                 /* Give all the gadgetry, but only display fixed width fonts */
  89.                 ASL_FuncFlags, FONF_FRONTCOLOR | FONF_BACKCOLOR |
  90.                     FONF_DRAWMODE | FONF_STYLES | FONF_FIXEDWIDTH,
  91.                 TAG_DONE))
  92.         {
  93.             /* Pop up the requester */
  94.             if (AslRequest(fr, NULL))
  95.             {
  96.                 /* The user selected something,  report their choice */
  97.                 printf("%s\n  YSize = %d  Style = 0x%x   Flags = 0x%x\n"
  98.                        "  FPen = 0x%x   BPen = 0x%x   DrawMode = 0x%x\n",
  99.                                fr->fo_Attr.ta_Name,
  100.                                fr->fo_Attr.ta_YSize,
  101.                                fr->fo_Attr.ta_Style,
  102.                                fr->fo_Attr.ta_Flags,
  103.                                fr->fo_FrontPen,
  104.                                fr->fo_BackPen,
  105.                                fr->fo_DrawMode);
  106.             }
  107.             else
  108.                 /* The user cancelled the requester, or some kind of error
  109.                 ** occurred preventing the requester from opening. */
  110.                 printf("Request Cancelled\n");
  111.             FreeAslRequest(fr);
  112.         }
  113.         CloseLibrary(AslBase);
  114.     }
  115. }
  116.